package com.smyx.demo.queue;

/**
 * @author SmyxMac
 * @version 1.0.0
 * @Description 测试数组队列
 * @createTime 2023年05月09日 22:36:00
 */
public class TestQueue {
    public static void main(String[] args) {
        testNormalQueue();
        System.out.println("***********************************");
        testCircleQueue();
    }

    private static void testCircleQueue() {
        ArrayCircleQueue queue = new ArrayCircleQueue(3);
        queue.addData(1);
        queue.showQueue();
        queue.addData(2);
        queue.showQueue();
        int data = queue.getData();
        System.out.printf("获取到的数据是>>> %d \n", data);
        System.out.printf("当前头部数据是>>> %d \n", queue.getHeadData());
        queue.showQueue();
        System.out.printf("当前头部数据是>>> %d \n", queue.getHeadData());
        queue.addData(3);
        data = queue.getData();
        System.out.printf("获取到的数据是>>> %d \n", data);
        System.out.printf("当前头部数据是>>> %d \n", queue.getHeadData());
        queue.showQueue();
    }

    private static void testNormalQueue() {
        ArrayNormalQueue queue = new ArrayNormalQueue(10);
        queue.addData(1);
        queue.addData(2);
        queue.addData(3);
        queue.showQueue();
        int data = queue.getData();
        System.out.printf("获取到的数据是>>> %d \n", data);
        System.out.printf("当前头部数据是>>> %d \n", queue.getHeadData());
        queue.showQueue();
        System.out.printf("当前头部数据是>>> %d \n", queue.getHeadData());
    }
}
